include $(top_srcdir)/automake/multilib.am
include $(top_srcdir)/automake/compile.am

SUBDIRS = cpu

## include

include_rtemsdir = $(includedir)/rtems

include_rtems_HEADERS = include/rtems/debug.h
include_rtems_HEADERS += include/rtems/system.h
include_rtems_HEADERS += include/rtems/seterr.h

include_rtems_scoredir = $(includedir)/rtems/score

include_rtems_score_HEADERS = include/rtems/score/address.h
include_rtems_score_HEADERS += include/rtems/score/apiext.h
include_rtems_score_HEADERS += include/rtems/score/apimutex.h
include_rtems_score_HEADERS += include/rtems/score/assert.h
include_rtems_score_HEADERS += include/rtems/score/chain.h
include_rtems_score_HEADERS += include/rtems/score/chainimpl.h
include_rtems_score_HEADERS += include/rtems/score/context.h
include_rtems_score_HEADERS += include/rtems/score/copyrt.h
include_rtems_score_HEADERS += include/rtems/score/corebarrier.h
include_rtems_score_HEADERS += include/rtems/score/corebarrierimpl.h
include_rtems_score_HEADERS += include/rtems/score/coremsg.h
include_rtems_score_HEADERS += include/rtems/score/coremsgimpl.h
include_rtems_score_HEADERS += include/rtems/score/coremutex.h
include_rtems_score_HEADERS += include/rtems/score/coremuteximpl.h
include_rtems_score_HEADERS += include/rtems/score/coresem.h
include_rtems_score_HEADERS += include/rtems/score/coresemimpl.h
include_rtems_score_HEADERS += include/rtems/score/cpuset.h
include_rtems_score_HEADERS += include/rtems/score/cpusetimpl.h
include_rtems_score_HEADERS += include/rtems/score/heap.h
include_rtems_score_HEADERS += include/rtems/score/heapimpl.h
include_rtems_score_HEADERS += include/rtems/score/protectedheap.h
include_rtems_score_HEADERS += include/rtems/score/interr.h
include_rtems_score_HEADERS += include/rtems/score/isr.h
include_rtems_score_HEADERS += include/rtems/score/isrlevel.h
include_rtems_score_HEADERS += include/rtems/score/isrlock.h
include_rtems_score_HEADERS += include/rtems/score/freechain.h
include_rtems_score_HEADERS += include/rtems/score/mrsp.h
include_rtems_score_HEADERS += include/rtems/score/mrspimpl.h
include_rtems_score_HEADERS += include/rtems/score/object.h
include_rtems_score_HEADERS += include/rtems/score/objectimpl.h
include_rtems_score_HEADERS += include/rtems/score/onceimpl.h
include_rtems_score_HEADERS += include/rtems/score/percpu.h
include_rtems_score_HEADERS += include/rtems/score/priority.h
include_rtems_score_HEADERS += include/rtems/score/prioritybitmap.h
include_rtems_score_HEADERS += include/rtems/score/prioritybitmapimpl.h
include_rtems_score_HEADERS += include/rtems/score/profiling.h
include_rtems_score_HEADERS += include/rtems/score/rbtree.h
include_rtems_score_HEADERS += include/rtems/score/rbtreeimpl.h
include_rtems_score_HEADERS += include/rtems/score/resource.h
include_rtems_score_HEADERS += include/rtems/score/resourceimpl.h
include_rtems_score_HEADERS += include/rtems/score/scheduler.h
include_rtems_score_HEADERS += include/rtems/score/schedulerimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulercbs.h
include_rtems_score_HEADERS += include/rtems/score/schedulercbsimpl.h
include_rtems_score_HEADERS += include/rtems/score/scheduleredf.h
include_rtems_score_HEADERS += include/rtems/score/scheduleredfimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulerpriority.h
include_rtems_score_HEADERS += include/rtems/score/schedulerpriorityimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulerprioritysmp.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimple.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimpleimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulersmp.h
include_rtems_score_HEADERS += include/rtems/score/schedulersmpimpl.h
include_rtems_score_HEADERS += include/rtems/score/smp.h
include_rtems_score_HEADERS += include/rtems/score/smpbarrier.h
include_rtems_score_HEADERS += include/rtems/score/smplock.h
include_rtems_score_HEADERS += include/rtems/score/smpimpl.h
include_rtems_score_HEADERS += include/rtems/score/stack.h
include_rtems_score_HEADERS += include/rtems/score/stackimpl.h
include_rtems_score_HEADERS += include/rtems/score/states.h
include_rtems_score_HEADERS += include/rtems/score/statesimpl.h
include_rtems_score_HEADERS += include/rtems/score/sysstate.h
include_rtems_score_HEADERS += include/rtems/score/thread.h
include_rtems_score_HEADERS += include/rtems/score/threadimpl.h
include_rtems_score_HEADERS += include/rtems/score/threaddispatch.h
include_rtems_score_HEADERS += include/rtems/score/threadq.h
include_rtems_score_HEADERS += include/rtems/score/threadqimpl.h
include_rtems_score_HEADERS += include/rtems/score/threadsync.h
include_rtems_score_HEADERS += include/rtems/score/timespec.h
include_rtems_score_HEADERS += include/rtems/score/timestamp.h
include_rtems_score_HEADERS += include/rtems/score/timestamp64.h
include_rtems_score_HEADERS += include/rtems/score/tls.h
include_rtems_score_HEADERS += include/rtems/score/tod.h
include_rtems_score_HEADERS += include/rtems/score/todimpl.h
include_rtems_score_HEADERS += include/rtems/score/userext.h
include_rtems_score_HEADERS += include/rtems/score/userextimpl.h
include_rtems_score_HEADERS += include/rtems/score/watchdog.h
include_rtems_score_HEADERS += include/rtems/score/watchdogimpl.h
include_rtems_score_HEADERS += include/rtems/score/wkspace.h
include_rtems_score_HEADERS += include/rtems/score/cpuopts.h
include_rtems_score_HEADERS += include/rtems/score/basedefs.h

if HAS_PTHREADS
include_rtems_score_HEADERS += include/rtems/score/corespinlock.h
include_rtems_score_HEADERS += include/rtems/score/corespinlockimpl.h
include_rtems_score_HEADERS += include/rtems/score/corerwlock.h
include_rtems_score_HEADERS += include/rtems/score/corerwlockimpl.h
endif

if HAS_MP
# We only build multiprocessing related files if HAS_MP was defined
include_rtems_score_HEADERS += include/rtems/score/mpci.h
include_rtems_score_HEADERS += include/rtems/score/mpciimpl.h
include_rtems_score_HEADERS += include/rtems/score/mppkt.h
include_rtems_score_HEADERS += include/rtems/score/objectmp.h
include_rtems_score_HEADERS += include/rtems/score/threadmp.h
endif

if HAS_SMP
include_rtems_score_HEADERS += include/rtems/score/atomic.h
include_rtems_score_HEADERS += include/rtems/score/cpustdatomic.h
include_rtems_score_HEADERS += include/rtems/score/schedulerprioritysmpimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulerpriorityaffinitysmp.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimplesmp.h
endif

## src

noinst_LIBRARIES = libscore.a
libscore_a_SOURCES =
libscore_a_CPPFLAGS = $(AM_CPPFLAGS)

# We only build multiprocessing related files if HAS_MP was defined
if HAS_MP
libscore_a_SOURCES += src/mpci.c src/objectmp.c src/threadmp.c
endif

if HAS_SMP
libscore_a_SOURCES += src/percpustatewait.c
libscore_a_SOURCES += src/profilingsmplock.c
libscore_a_SOURCES += src/schedulerchangeroot.c
libscore_a_SOURCES += src/schedulerpriorityaffinitysmp.c
libscore_a_SOURCES += src/schedulerprioritysmp.c
libscore_a_SOURCES += src/schedulersimplesmp.c
libscore_a_SOURCES += src/schedulersmpdebug.c
libscore_a_SOURCES += src/smp.c
libscore_a_SOURCES += src/cpuset.c
libscore_a_SOURCES += src/cpusetprintsupport.c
libscore_a_SOURCES += src/schedulerdefaultaskforhelp.c
libscore_a_SOURCES += src/schedulerdefaultgetaffinity.c
libscore_a_SOURCES += src/schedulerdefaultsetaffinity.c
libscore_a_SOURCES += src/schedulersmpstartidle.c
endif

## CORE_APIMUTEX_C_FILES
libscore_a_SOURCES += src/apimutex.c \
    src/apimutexlock.c src/apimutexunlock.c

## CORE_BARRIER_C_FILES
libscore_a_SOURCES += src/corebarrier.c src/corebarrierrelease.c \
    src/corebarrierwait.c

## CORE_MESSAGE_QUEUE_C_FILES
libscore_a_SOURCES += src/coremsg.c src/coremsgbroadcast.c \
    src/coremsgclose.c src/coremsgflush.c src/coremsgflushwait.c \
    src/coremsginsert.c src/coremsgflushsupp.c src/coremsgseize.c \
    src/coremsgsubmit.c

## CORE_MUTEX_C_FILES
libscore_a_SOURCES += src/coremutex.c src/coremutexflush.c \
    src/coremutexseize.c src/coremutexsurrender.c \
    src/coremutexseizeintr.c

## CORE_PERCPU_C_FILES
libscore_a_SOURCES += src/percpu.c
libscore_a_SOURCES += src/percpuasm.c

## CORE_RWLOCK_C_FILES
if HAS_PTHREADS
libscore_a_SOURCES += src/corerwlock.c src/corerwlockobtainread.c \
    src/corerwlockobtainwrite.c src/corerwlockrelease.c src/corerwlocktimeout.c
endif

## CORE_SEMAPHORE_C_FILES
libscore_a_SOURCES += src/coresem.c src/coresemflush.c src/coresemseize.c \
    src/coresemsurrender.c

## CORE_SPINLOCK_C_FILES
if HAS_PTHREADS
libscore_a_SOURCES += src/corespinlock.c src/corespinlockrelease.c \
    src/corespinlockwait.c
endif

## HEAP_C_FILES
libscore_a_SOURCES += src/heap.c src/heapallocate.c src/heapextend.c \
    src/heapfree.c src/heapsizeofuserarea.c src/heapwalk.c src/heapgetinfo.c \
    src/heapgetfreeinfo.c src/heapresizeblock.c src/heapiterate.c \
    src/heapgreedy.c src/heapnoextend.c

## OBJECT_C_FILES
libscore_a_SOURCES += src/objectallocate.c src/objectclose.c \
    src/objectextendinformation.c src/objectfree.c src/objectget.c \
    src/objectgetisr.c src/objectgetnext.c src/objectinitializeinformation.c \
    src/objectnametoid.c src/objectnametoidstring.c \
    src/objectshrinkinformation.c src/objectgetnoprotection.c \
    src/objectidtoname.c src/objectgetnameasstring.c src/objectsetname.c \
    src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c \
    src/objectnamespaceremove.c \
    src/objectactivecount.c

## SCHEDULER_C_FILES
libscore_a_SOURCES += src/log2table.c
libscore_a_SOURCES += src/scheduler.c
libscore_a_SOURCES += src/schedulergetaffinity.c
libscore_a_SOURCES += src/schedulersetaffinity.c
libscore_a_SOURCES += src/schedulerdefaultnodedestroy.c
libscore_a_SOURCES += src/schedulerdefaultnodeinit.c
libscore_a_SOURCES += src/schedulerdefaultreleasejob.c
libscore_a_SOURCES += src/schedulerdefaultschedule.c
libscore_a_SOURCES += src/schedulerdefaultstartidle.c
libscore_a_SOURCES += src/schedulerdefaulttick.c
libscore_a_SOURCES += src/schedulerdefaultupdate.c

## SCHEDULERPRIORITY_C_FILES
libscore_a_SOURCES += src/schedulerpriority.c \
    src/schedulerpriorityblock.c \
    src/schedulerprioritychangepriority.c \
    src/schedulerpriorityprioritycompare.c \
    src/schedulerpriorityschedule.c \
    src/schedulerpriorityunblock.c \
    src/schedulerpriorityupdate.c \
    src/schedulerpriorityyield.c

## SCHEDULERSIMPLE_C_FILES
libscore_a_SOURCES += src/schedulersimple.c \
    src/schedulersimpleblock.c \
    src/schedulersimplechangepriority.c \
    src/schedulersimpleschedule.c \
    src/schedulersimpleunblock.c \
    src/schedulersimpleyield.c

## SCHEDULEREDF_C_FILES
libscore_a_SOURCES += src/scheduleredf.c \
    src/scheduleredfnodeinit.c \
    src/scheduleredfblock.c \
    src/scheduleredfchangepriority.c \
    src/scheduleredfprioritycompare.c \
    src/scheduleredfreleasejob.c \
    src/scheduleredfschedule.c \
    src/scheduleredfunblock.c \
    src/scheduleredfupdate.c \
    src/scheduleredfyield.c

## SCHEDULERCBS_C_FILES
libscore_a_SOURCES += src/schedulercbs.c \
    src/schedulercbsnodeinit.c \
    src/schedulercbsattachthread.c \
    src/schedulercbscleanup.c \
    src/schedulercbscreateserver.c \
    src/schedulercbsdestroyserver.c \
    src/schedulercbsdetachthread.c \
    src/schedulercbsgetapprovedbudget.c \
    src/schedulercbsgetexecutiontime.c \
    src/schedulercbsgetparameters.c \
    src/schedulercbsgetremainingbudget.c \
    src/schedulercbsgetserverid.c \
    src/schedulercbssetparameters.c \
    src/schedulercbsreleasejob.c \
    src/schedulercbsunblock.c

## PROTECTED_HEAP_C_FILES
libscore_a_SOURCES += src/pheapallocate.c \
    src/pheapextend.c src/pheapfree.c src/pheapgetsize.c \
    src/pheapgetblocksize.c src/pheapgetfreeinfo.c src/pheapgetinfo.c \
    src/pheapinit.c src/pheapresizeblock.c src/pheapwalk.c src/pheapiterate.c

## FREECHAIN_C_FILES
libscore_a_SOURCES += src/freechain.c

## RBTREE_C_FILES
libscore_a_SOURCES += src/rbtree.c \
    src/rbtreeextract.c src/rbtreefind.c \
    src/rbtreeinsert.c src/rbtreeiterate.c src/rbtreenext.c

## THREAD_C_FILES
libscore_a_SOURCES += src/thread.c src/threadchangepriority.c \
    src/threadclearstate.c src/threadcreateidle.c \
    src/threaddelayended.c src/threaddispatch.c \
    src/threadenabledispatch.c src/threaddisabledispatch.c \
    src/threadget.c src/threadhandler.c src/threadinitialize.c \
    src/threadloadenv.c src/threadready.c \
    src/threadrestart.c src/threadsetpriority.c \
    src/threadsetstate.c \
    src/threadstackallocate.c src/threadstackfree.c src/threadstart.c \
    src/threadstartmultitasking.c src/iterateoverthreads.c \
    src/threadblockingoperationcancel.c
libscore_a_SOURCES += src/threadglobalconstruction.c
libscore_a_SOURCES += src/threadyield.c

if HAS_SMP
libscore_a_SOURCES += src/smpbarrierwait.c
libscore_a_SOURCES += src/threaddispatchdisablelevel.c
endif

## THREADQ_C_FILES
libscore_a_SOURCES += src/threadq.c src/threadqdequeue.c \
    src/threadqenqueue.c src/threadqextract.c src/threadqrequeue.c \
    src/threadqextractwithproxy.c src/threadqfirst.c \
    src/threadqflush.c src/threadqprocesstimeout.c src/threadqtimeout.c

## TIMESPEC_C_FILES
libscore_a_SOURCES += src/timespecaddto.c src/timespecfromticks.c \
    src/timespecisvalid.c src/timespeclessthan.c \
    src/timespecsubtract.c src/timespectoticks.c src/timespecdivide.c \
    src/timespecdividebyinteger.c src/timespecgetasnanoseconds.c

## TIMESTAMP_INT64_C_FILES
libscore_a_SOURCES += src/ts64addto.c src/ts64dividebyinteger.c \
    src/ts64divide.c src/ts64equalto.c \
    src/ts64getnanoseconds.c src/ts64getseconds.c \
    src/ts64lessthan.c \
    src/ts64set.c src/ts64settozero.c src/ts64subtract.c \
    src/ts64toticks.c src/ts64totimespec.c src/ts64totimeval.c

## TOD_C_FILES
libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodget.c \
    src/coretodgetuptimetimespec.c src/coretodtickle.c \
    src/coretodsecondssinceepoch.c src/coretodtickspersec.c \
    src/coretodadjust.c

## WATCHDOG_C_FILES
libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
    src/watchdogadjusttochain.c src/watchdoginsert.c src/watchdogremove.c \
    src/watchdogtickle.c

## USEREXT_C_FILES
libscore_a_SOURCES += src/userextaddset.c \
    src/userext.c src/userextremoveset.c src/userextiterate.c

## STD_C_FILES
libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
    src/chainextract.c src/chainget.c src/chaininsert.c \
    src/chainappendempty.c src/chainprependempty.c src/chaingetempty.c \
    src/chainnodecount.c \
    src/debugisthreaddispatchingallowed.c \
    src/interr.c src/isr.c src/wkspace.c src/wkstringduplicate.c
libscore_a_SOURCES += src/debugisownerofallocator.c
libscore_a_SOURCES += src/profilingisrentryexit.c
libscore_a_SOURCES += src/once.c
libscore_a_SOURCES += src/resourceiterate.c

EXTRA_DIST = src/Unlimited.txt

DISTCLEANFILES = include/rtems/score/cpuopts.h

include $(srcdir)/preinstall.am
include $(top_srcdir)/automake/subdirs.am
include $(top_srcdir)/automake/local.am
